<template>
  <div style="overflow-x: auto; width: 100%;">
    <el-table size="mini" border :data="dataTable" :style="{ minWidth: tableWidth + 'px' }">
      <el-table-column v-for="(week, index) in weeks" :key="index" :label="week.label">
        <el-row>
          <el-col tag="工作计划" :span="12">
            <el-table :data="week.taskPlanSummaries" size="mini" :show-header="false">
              <el-table-column type="index" width="20px"></el-table-column>
              <el-table-column>
                <template #default="scope">
                  <el-input type="textarea" size="medium" :autosize="{ minRows: 2, maxRows: 8 }"
                            style="font-size: 12px; margin: 0 0 10px 0;" v-model="scope.row.taskPlan"
                            placeholder="请输入计划内容" :disabled="isEditable(index, 'taskPlan')"></el-input>
                </template>
              </el-table-column>
            </el-table>
          </el-col>
          <el-col tag="完成情况" :span="12">
            <el-table :data="week.taskCompleteSummaries" size="mini" :show-header="false">
              <el-table-column>
                <template #default="scope">
                  <el-input type="textarea" size="medium" :autosize="{ minRows: 2, maxRows: 8 }"
                            style="font-size: 12px; margin: 0 0 10px 0;" v-model="scope.row.taskComplete"
                            placeholder="请输入任务完成情况" :disabled="isEditable(index, 'taskComplete')"></el-input>
                </template>
              </el-table-column>
            </el-table>

            <div
                style="display: flex; align-items: flex-start; justify-content: left; gap:20px; width: 100%; margin-left: 20px">
              <el-button @click="addRow(week)" type="text" icon="el-icon-plus"></el-button>
              <el-button @click="removeRow(week)" type="text" icon="el-icon-minus"></el-button>
              <el-button @click="addComment(week.id)" type="text" icon="el-icon-chat-line-round"></el-button>
              <el-upload
                  class="upload-demo"
                  action="http://localhost:8080/file/upload/"
                  multiple
                  :on-success="(response, file, fileList) => handleReportSuccess(response, file, fileList, '汇报时')"
                  :file-list="reportFileList">
                <el-button type="text" icon="el-icon-paperclip"></el-button>
              </el-upload>
            </div>


            <el-table :data="task.taskAttachments" :show-header="false" size="mini">
              <el-table-column type="index"></el-table-column>
              <el-table-column>
                <template slot-scope="scope">
                  <el-link :href="'http://localhost/' + scope.row.filePath" target="_blank">{{
                      scope.row.filePath
                    }}
                  </el-link>
                </template>
              </el-table-column>
            </el-table>
          </el-col>
        </el-row>
        <el-row>
          <el-col tag="需协调解决的问题" :span="24">
            <el-table :data="week.taskCoordinateSummaries" size="mini" :show-header="false" style="width: 100%">
              <el-table-column type="index" width="20px"></el-table-column>
              <el-table-column>
                <template #default="scope">
                  <el-input type="textarea" size="medium" :autosize="{ minRows: 2, maxRows: 8 }"
                            style="font-size: 12px; margin: 0 0 10px 0;" v-model="scope.row.taskCoordinate"
                            placeholder="请输入协调内容" :disabled="isEditable(index, 'taskCoordinate')"></el-input>
                </template>
              </el-table-column>
            </el-table>
            <div
                style="display: flex; align-items: center; justify-content: left; gap:20px ; width: 100%; margin-left: 20px">
              <el-button @click="addRowForCoordination(week)" type="text" icon="el-icon-plus"></el-button>
              <el-button @click="removeRowForCoordination(week)" type="text"
                         icon="el-icon-minus"></el-button>
            </div>
          </el-col>
          <el-row>
            <el-col tag="评论区" :span="24">
              <el-table :data="week.taskCommentSummaries" size="mini" :show-header="false" style="width: 100%">
                <el-table-column type="index" width="20px"></el-table-column>
                <el-table-column prop="commentContent"></el-table-column>
                <el-table-column>
                  <template #default="scope">
                    <el-link :href="'http://localhost/' + scope.row.attachmentPath" target="_blank">{{ scope.row.attachmentPath }}</el-link>
                  </template>
                </el-table-column>
                <el-table-column prop="commentAttachment"></el-table-column>
                <el-table-column prop="createBy"></el-table-column>
                <el-table-column prop="createTime"></el-table-column>
              </el-table>
            </el-col>
          </el-row>

        </el-row>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  data() {

  },
  methods: {

  }
};
</script>
